﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ucKhoaHoc.ascx.cs" Inherits="STT.Admin.WebForms.ucKhoaHoc" %>
<style>
    #thediv_scroll1 {
        height: 100px;
        width: 100%;
        margin-left: 0px;
        overflow: auto; /* thuoc tinh nay lam xuat hien thanh cuon*/
    }


    #thediv_canle {
        padding-left: 40px;
    }
</style>

<%--<div id="content-header">
    <div id="breadcrumb">
        <a href="../Admin/Default.aspx?idpage=1" class="tip-bottom" data-original-title="Về bảng điều khiển">
            <i class="icon-home"></i>Trang chính
        </a>
         <a href="../Admin/Default.aspx?" class="current">Quản lý khóa-lớp học</a>
        <a href="../Admin/Default.aspx?idpage=qlkh" class="current">Quản lý khóa học</a>
    </div>
</div>--%>

<div class="widget-box">
    <div class="control-group" style="border: thin solid #CCCCFF">
        <asp:Panel ID="plError" runat="server" Visible="false">
            <br />
            <div id="thediv_scroll1">
                <div id="thediv_canle">
                    <asp:Label ID="lbError" runat="server" ForeColor="Red"></asp:Label>
                </div>
            </div>
            <br />
        </asp:Panel>
    </div>

    <div class="widget-title">
        <span class="icon"><i class="icon-th"></i></span>
        <h5>Danh sách các khóa học</h5>

        <div id="search">
            <asp:TextBox ID="txtTimKiem" runat="server" placeholder="Nhập từ tìm kiếm..."></asp:TextBox>
            <button class="tip-left" data-original-title="Tìm kiếm">
                <asp:ImageButton ID="btSearch" runat="server" ImageUrl="~/img/icon-search.png" OnClick="btSearch_Click" />
            </button>
        </div>
    </div>

    <div class="widget-content nopadding">
        <div id="DataTables_Table_0_wrapper" class="dataTables_wrapper" role="grid">
            <asp:GridView ID="gvKhoaHoc" runat="server" CssClass="table table-bordered table-hover"
                AutoGenerateColumns="False" DataKeyNames="MaKhoaHoc"
                OnRowCancelingEdit="gvKhoaHoc_RowCancelingEdit"
                OnRowDeleting="gvKhoaHoc_RowDeleting"
                OnPageIndexChanging="gvKhoaHoc_PageIndexChanging" EnableViewState="False"
                OnRowCommand="gvKhoaHoc_RowCommand" AllowPaging="True" PageSize="15">
                <Columns>
                    <asp:TemplateField>
                        <HeaderTemplate>
                            <%-- Bắt sự kiện nhấn cbChonTat --%>
                            <asp:CheckBox ID="cbChonTat" runat="server" onclick="cbChonTat(this);" />
                        </HeaderTemplate>
                        <ItemTemplate>
                            <%-- Bắt sự kiện nhấn cbChon --%>
                            <asp:CheckBox ID="cbChon" runat="server" onclick="cbChon(this);" />
                        </ItemTemplate>
                        <ItemStyle Width="10px" HorizontalAlign="Center"></ItemStyle>
                    </asp:TemplateField>
                    <%--<asp:BoundField DataField="MaKhoaHoc" HeaderText="Mã khóa học"
                        InsertVisible="False" ReadOnly="True" SortExpression="MaKhoaHoc"
                        ItemStyle-CssClass="span1">
                        <ItemStyle CssClass="span1"></ItemStyle>
                    </asp:BoundField>--%>
                    <asp:BoundField DataField="TenKhoaHoc" HeaderText="Tên khóa học"
                        SortExpression="TenKhoaHoc" ItemStyle-CssClass="span2">
                        <ItemStyle CssClass="span2"></ItemStyle>
                    </asp:BoundField>
               
                     <asp:TemplateField HeaderText="Chi tiết" ItemStyle-CssClass="span1"
                        ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <a href="#thongTin" data-toggle="modal" onclick="GetThongTin('<%# Eval("NoiDung") %>')">
                                <img src="../../img/detail.jpg" alt="Alternate Text" />
                            </a>
                        </ItemTemplate>

                        <ItemStyle HorizontalAlign="Center" CssClass="span1"></ItemStyle>
                    </asp:TemplateField>
                    <asp:BoundField DataField="DiaDiemHoc" HeaderText="Địa điểm học"
                        SortExpression="DiaDiemHoc" ItemStyle-CssClass="span2">
                        <ItemStyle CssClass="span2"></ItemStyle>
                    </asp:BoundField>
                    <asp:BoundField DataField="ThoiGianBatDau" DataFormatString="{0:dd-MM-yyyy}"
                        HeaderText="Thời gian bắt đầu" ItemStyle-CssClass="span2">
                        <ItemStyle CssClass="span2"></ItemStyle>
                    </asp:BoundField>
                    <asp:BoundField DataField="ThoiGianKetThuc" DataFormatString="{0:dd-MM-yyyy}"
                        HeaderText="Thời gian kết thúc" ItemStyle-CssClass="span2">
                        <ItemStyle CssClass="span2"></ItemStyle>
                    </asp:BoundField>

                    <asp:TemplateField HeaderText="Sửa" ShowHeader="False">
                        <ItemTemplate>
                            <%-- Bắt sự kiện nhấn nút sửa --%>
                            <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False"
                                Text="Sửa" CommandName="ChonSua" CommandArgument="<%#((GridViewRow)Container).RowIndex%>">
                                <img src="../../img/edit.jpg" alt="Alternate Text" />
                            </asp:LinkButton>
                        </ItemTemplate>
                        <ItemStyle CssClass="span1" HorizontalAlign="Center" VerticalAlign="Middle" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Xóa" ShowHeader="False">
                        <ItemTemplate>
                            <%-- Bắt sự kiện nhấn nút xóa --%>
                            <asp:LinkButton ID="LinkButton2" runat="server" type="submit" CommandName="Delete"
                                OnClientClick="return ConfirmDelete('Có chắc bạn muốn xóa?');">
                                <img src="../../img/delete.jpg" alt="Alternate Text" />
                            </asp:LinkButton>

                        </ItemTemplate>
                        <ItemStyle CssClass="span1" HorizontalAlign="Center" VerticalAlign="Middle" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Tạo lớp học mới" ShowHeader="False">
                        <ItemTemplate>
                            <%-- Bắt sự kiện nhấn nút tạo lớp học --%>
                            <asp:LinkButton ID="LinkButton3" runat="server" CommandName="CreateClass"
                                CommandArgument="<%#((GridViewRow)Container).RowIndex%>">
                                <img src="../../img/add.png" alt="Tạo lớp học mới" />
                            </asp:LinkButton>

                        </ItemTemplate>
                        <ItemStyle CssClass="span1" HorizontalAlign="Center" VerticalAlign="Middle" />
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>

            <div class="fg-toolbar ui-toolbar ui-widget-header ui-corner-bl">

                <asp:LinkButton ID="lbXoaTat" runat="server" CssClass="btn" OnClientClick="return ConfirmDelete('Có chắc bạn muốn xóa các dòng đã chọn?');"
                    OnClick="lbXoaTat_Click">Xóa chọn</asp:LinkButton>

                <div class="btn-group">
                    <asp:HyperLink ID="HyperLink1" CssClass="btn" runat="server" NavigateUrl="~/Admin/Default.aspx?idpage=tkhm">                        
                            Thêm mới
                    </asp:HyperLink>
                    <button data-toggle="dropdown" class="btn dropdown-toggle">
                        <span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu">
                        <li><a href="#themFileExcel" data-toggle="modal">Thêm từ file Excel</a></li>
                    </ul>
                </div>
                <asp:HyperLink ID="HyperLink2" CssClass="btn" Target="_blank" runat="server" NavigateUrl="~/Report/ViewKhoaHoc.aspx">                        
                            Xuất dữ liệu
                </asp:HyperLink>
               

            </div>
        </div>
    </div>
</div>
<asp:HiddenField ID="hfMaKhoaHoc" runat="server" />


<div id="themFileExcel" class="modal hide" aria-hidden="true" style="display: none;">
    <div class="modal-header">
        <button data-dismiss="modal" class="close" type="button">×</button>
        <h3 runat="server" id="H1">Thêm từ file Excel</h3>
    </div>
    <div class="modal-body">
        <asp:FileUpload ID="FileUpload1" runat="server" />
    </div>
    <div class="modal-footer">
        <asp:Button ID="btThemExcel" runat="server" CssClass="btn btn-primary"
            Text="Thêm"
            OnClick="btThemExcel_Click" />
        <a data-dismiss="modal" class="btn" href="#">Hủy</a>
    </div>
</div>

<div id="thongTin" class="modal modal-big hide" aria-hidden="true" style="display: none;">
    <div class="modal-header">
        <button data-dismiss="modal" class="close" type="button">×</button>
        <h3 runat="server" id="txtTieuDe">Nội dung chi tiết</h3>
    </div>
    <div class="modal-body">
        <label id="noidung"></label>
    </div>
    <div class="modal-footer">
        <a data-dismiss="modal" class="btn" href="#" id="cancel">Hủy</a>
    </div>
</div>


<script>

    $(document).ready(function () {
        $('.btValidate').click(function () {
            $('form').quickValidate();
        });
    });

    function GetThongTin(str) {
        $('#noidung').html(str);
    }
</script>
